package com.roc.template.base;

import lombok.Data;

import java.io.Serializable;

@Data
public class Result implements Serializable {
	private static final long serialVersionUID = -788043879245177427L;
	private boolean success = true;
	private String error;
	private String errorCode;
	private Object data;

    public Result() {
    }

    public Result(boolean success, String error, String errorCode, Object data) {
		this.success = success;
		this.error = error;
		this.errorCode = errorCode;
		this.data = data;
	}

	public static Result SUCCESS(Object data) {
        Result result = new Result();
        result.success=true;
        result.data=data;
        return  result;
    }

    public static Result FAILED(String error, String errorCode) {
        Result result = new Result();
        result.success=false;
        result.error=error;
        result.errorCode=errorCode;
        return  result;
    }

}